package com.sch.study.base;

import com.sch.study.pattern.Food;

/**
 * User: hui_stone
 * Date: 2015/5/30 0030
 * Time: 下午 14:55
 */
public class NewInstance {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {

        Class c = Class.forName("com.sch.study.pattern.Food");

        Food food = (Food)c.newInstance();

        food.setName("112");

        System.out.println(food.getName());
    }
}
